#!/bin/bash
function dots
{
	while : ; do
		echo -n ". "
		sleep 1s
	done
}

echo "Compiling Library..."
dots &
pid=$!
g++ -I/usr/local/lib64/R/include -L/usr/local/lib -I ~/ -I -DNDEBUG -I/usr/local/atlas/include -I/usr/local/include -lboost -lblas -latlas -llapack -fopenmp -larmadillo -fpic -lgsl -lgslcblas -g -O3  -c test/Rinterface.cpp -o test/Rinterface.o
disown $pid
kill -9 $pid
echo -e "\nCompiling Fortran for Scrambling..."
gfortran -fpic -O3 -c include/simulate/scrambling.f -o 085A-LowDiscrepancy.o
#cd include/simulate/univariate/Main
#./compile.sh
#cd ../../../..y
echo "Linking..."
g++ -shared -L/usr/local/lib64 -L ~/ -llapack -larmadillo -lgsl -lgslcblas -fopenmp -o test/Rinterface.so test/Rinterface.o 085A-LowDiscrepancy.o  -lgfortran -lm

